<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'input.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<script type="text/javascript">
		function vilidateUserName(){
				var username = document.getElementById("username").value;
				var userText = document.getElementById("userText");
				if(username == "" || username == null){
					userText.innerHTML="<font color=red>账号不能为空</font>";
					return false;
				}else{
					userText.innerHTML="<font color=blue>格式正确</font>";
					return true;
				}
			}
			function vilidateUserPass(){
				var userpass = document.getElementById("password").value;
				var pwdText = document.getElementById("pwdText");
				if(userpass == "" || userpass == null){
					pwdText.innerHTML="<font color=red>账号不能为空</font>";
					return false;
				}else{
					pwdText.innerHTML="<font color=blue>格式正确</font>";
					return true;
				}
			}
			function vilidateSubmit(){
				return vilidateUserName() && vilidateUserPass();
			}
	</script>
  </head>
  
  <body>
   <form action="login_service.jsp" method="post" onsubmit="return vilidateSubmit()">
   		<table>
   			<tr>
   				<td>用户名：</td>
   				<td>
   					<input type="text" name="username" size="20"/ onblur="vilidateUserName()">
   				</td>
   				<td>
   					<div id="userText"></div>
   				</td>
   			</tr>
   			<tr>
   				<td>密&nbsp;&nbsp;码：</td>
   				<td>
   					<input type="password" name="password" size="21" onblur="vilidateUserPass()"/>
   				</td>
   				<td>
   					<div id="pwdText"></div>
   				</td>
   			</tr>
   			<tr>
   				<td>&nbsp;</td>
   				<td>
   					<input type="reset" value="重置"/>&nbsp;&nbsp;
   					<input type="submit" value="提交"/>
   				</td>
   				<td>&nbsp;</td>
   			</tr>
   		</table>
   </form>
  </body>
</html>
